package com.平方根问题;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int count=0;
		for(int a=1;a<=n;a++) {
			for(int b=1;b<=m;b++) {
				double res = Math.sqrt(a*b);
				if(res==(int)res) {
					count++;
				}
			}
		}
		System.out.println(count);
	}

}
